package com.flong.sys;

import java.util.Iterator;
import java.util.List;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.flong.common.IoUtil;
import com.flong.common.ObjectUtil;
import com.google.gson.Gson;

public class ShuiYiShengMain {
	private static Gson gson = new Gson();

	public static void main(String[] args) {

		
		//String path = ShuiYiShengMain.class.getClassLoader().getResource("com/flong/sys/js.txt").getPath();
		String path = "D:/data/sys/txt";

		List<String> findFiles = IoUtil.findFiles(path);
		String retMsg ="";
		for (String s : findFiles) {
			String jsonText = IoUtil.reader(s);
			//String json = gson.toJson(jsonText);
			JSONObject parseObject = JSON.parseObject(jsonText);

			String data = parseObject.get("data").toString();
			JSONArray jarr = JSONArray.parseArray(data);// JSON.parseArray(jsonStr);
			for (Iterator iterator = jarr.iterator(); iterator.hasNext();) {
				JSONObject job = (JSONObject) iterator.next();
				UserVo userVo = job.toJavaObject(UserVo.class);
				if (!ObjectUtil.isEmpty(userVo.getPhone()) && !ObjectUtil.isEmpty(userVo.getRealname())) {
					//System.out.println(userVo.getRealname() + "=" + userVo.getPhone());
					retMsg += userVo.getRealname() + "=" + userVo.getPhone();
					// String weibo=job.get("phone").toString();
					// System.out.println(weibo);
				}
			}
		}
		
		
		IoUtil.Writer(retMsg, "d:/data/0000.txt");
		
	}
	
} 

